/**
 * 初始化装车登记详情对话框
 */
var CarryBasicInformationInfoDlg = {
    carryBasicInformationInfoData : {}
};

/**
 * 清除数据
 */
CarryBasicInformationInfoDlg.clearData = function() {
    this.carryBasicInformationInfoData = {};
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
CarryBasicInformationInfoDlg.set = function(key, val) {
    this.carryBasicInformationInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}

/**
 * 数据验证
 */
function test(){
	
	var isFine = true;
	
	if($("#carryDate").val()==""){
		alert("装车日期不能为空！");
		$("#carryDate").focus();
		isFine = false;
		return isFine;
	}
	
	if($("#carryCarId").val()==""){
		alert("车号不能为空！");
		$("#carryCarId").focus();
		isFine = false;
		return isFine;
	}
	
	if($("#carryCarDriver").val()==""){
		alert("驾驶员不能为空！");
		$("#carryCarDriver").focus();
		isFine = false;
		return isFine;
	}
	
	
	
	if($("#carryCarDriverTell").val()==""){
		alert("联系电话不能为空！");
		$("#carryCarDriverTell").focus();
		isFine = false;
		return isFine;
	}
	if($("#receiveConsignerPlace").val()==""){
		alert("发货人地址不能为空！");
		$("#receiveConsignerPlace").focus();
		isFine = false;
		return isFine;
	}
	
	if($("#receiveConsignee").val()==""){
		alert("收货人不能为空！");
		$("#receiveConsignee").focus();
		isFine = false;
		return isFine;
	}
	
	if($("#carryCarDriverMobile").val()==""){
		alert("手机不能为空！");
		$("#carryCarDriverMobile").focus();
		isFine = false;
		return isFine;
	}
	
	
	if($("#carryRouteId").val()==""){
		alert("物流线路不能为空！");
		$("#carryRouteId").focus();
		isFine = false;
		return isFine;
	}
	if($("#carryRouteStart").val()==""){
		alert("始发站不能为空！");
		$("#carryRouteStart").focus();
		isFine = false;
		return isFine;
	}
	if($("#carryRouteEnd").val()==""){
		alert("到站不能为空！");
		$("#carryRouteEnd").focus();
		isFine = false;
		return isFine;
	}
	if($("#carryContractNumber").length==0){
		alert("装车合同物品不能为空！");
		isFine = false;
		return isFine;
	}
	
	
	$("input[name='carryThisQuantity']").each(function(){
		if($(this).val()==""||$(this).val()=="0"){
			alert("本次发货数量不能为空或者0");
			isFine = false;
			return isFine;
		}
	});
	
	//判断合同号物品号是否重复
	var ary = new Array();
	var i = 0;
	$("input[name='carryContractNumber']").each(function(){
		ary[i] = $(this).val()+ $(this).parent().siblings().eq(7).children().eq(0).val();
		i++;
	});
	var nary = ary.sort();
	
	for(var i=0;i<ary.length;i++){

		if (nary[i]==nary[i+1]){

		alert("同一合同下货物不能重复！");
		isFine = false;
		return;
		}
	} 
	
	return isFine;
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
CarryBasicInformationInfoDlg.get = function(key) {
    return $("#" + key).val();
}

/**
 * 关闭此对话框
 */
CarryBasicInformationInfoDlg.close = function() {
    parent.layer.close(window.parent.CarryBasicInformation.layerIndex);
}

/**
 * 收集数据
 */
CarryBasicInformationInfoDlg.collectData = function() {
    this
    .set('id')
    .set('carryId')
    .set('carryDate')
    .set('carryTradePerson')
    .set('carryCarId')
    .set('carryCarDriver')
    .set('carryCarDriverTell')
    .set('carryCarDriverMobile')
    .set('carryRouteId')
    .set('carryRouteStart')
    .set('carryRouteEnd')
    .set('carryRouteTransferStation')
    .set('carryCheck')
    .set('carryRemark');
}

/**
 * 提交json数据的处理
 */
//form序列化，转成单个json对象
$.fn.serializeObject = function()    
{    
   var o = {};    
   var a = this.serializeArray();    
   $.each(a, function() {    
       if (o[this.name]) {    
           if (!o[this.name].push) {    
               o[this.name] = [o[this.name]];    
           }    
           o[this.name].push(this.value || '');    
       } else {    
           o[this.name] = this.value || '';    
       }    
   });    
   return o;    
};  

//form序列化，转成json的list
$.fn.serializeJson = function(){
    var jsonData1 = {};
    var serializeArray = this.serializeArray();
    // 先转换成{"id": ["12","14"], "name": ["aaa","bbb"], "pwd":["pwd1","pwd2"]}这种形式
    $(serializeArray).each(function () {
        if (jsonData1[this.name]) {
            if ($.isArray(jsonData1[this.name])) {
                jsonData1[this.name].push(this.value);
            } else {
                jsonData1[this.name] = [jsonData1[this.name], this.value];
            }
        } else {
            jsonData1[this.name] = this.value;
        }
    });
    // 再转成[{"id": "12", "name": "aaa", "pwd":"pwd1"},{"id": "14", "name": "bb", "pwd":"pwd2"}]的形式
    var vCount = 0;
    // 计算json内部的数组最大长度
    for(var item in jsonData1){
        var tmp = $.isArray(jsonData1[item]) ? jsonData1[item].length : 1;
        vCount = (tmp > vCount) ? tmp : vCount;
    }

    if(vCount > 1) {
        var jsonData2 = new Array();
        for(var i = 0; i < vCount; i++){
            var jsonObj = {};
            for(var item in jsonData1) {
                jsonObj[item] = jsonData1[item][i];
            }
            jsonData2.push(jsonObj);
        }
        return JSON.stringify(jsonData2);
    }else{
        return "[" + JSON.stringify(jsonData1) + "]";
    }
};
/**
 * 提交添加
 */
CarryBasicInformationInfoDlg.addSubmit = function() {
	if(test()==true){
		var modelCarry = {};
	    modelCarry.carId = $("#carId").val();
	    modelCarry.routeId = $("#routeId").val();
	    var jsonArray = JSON.parse($("#carryContractInformations").serializeJson());
	    modelCarry.carryContractInformations = jsonArray;
	    modelCarry.carryBasicInformation = $("#carryBasicInformation").serializeObject();
	    var jsonData = JSON.stringify(modelCarry);
	    
	    $.ajax({
			async : false,
			type : 'post',
			url : Feng.ctxPath+'/carryBasicInformation/add',
			contentType : "application/json;charset=UTF-8",
			data :jsonData,
			success : function(data) {
				if (data == 'SUCCESS') {
					Feng.success("添加成功!");
			        window.parent.CarryBasicInformation.table.refresh();
			        CarryBasicInformationInfoDlg.close();
				} else {
					 Feng.error("添加失败!");
				}
			},
			error : function(data) {
				 Feng.error("添加失败!");
			}
		});
	}
}

/**
 * 提交修改
 */
CarryBasicInformationInfoDlg.editSubmit = function() {
	if(test()==true){
		var modelCarry = {};
	    modelCarry.carId = $("#carId").val();
	    modelCarry.routeId = $("#routeId").val();
	    var jsonArray = JSON.parse($("#carryContractInformations").serializeJson());
	    modelCarry.carryContractInformations = jsonArray;
	    modelCarry.carryBasicInformation = $("#carryBasicInformation").serializeObject();
	    var jsonData = JSON.stringify(modelCarry);
	    $.ajax({
			async : false,
			type : 'post',
			url : Feng.ctxPath+'/carryBasicInformation/update',
			contentType : "application/json;charset=UTF-8",
			data :jsonData,
			success : function(data) {
				if (data == 'SUCCESS') {
					Feng.success("修改成功!");
			        window.parent.CarryBasicInformation.table.refresh();
			        CarryBasicInformationInfoDlg.close();
				} else {
					 Feng.error("修改失败!该记录已经通过审核！");
				}
			},
			error : function(data) {
				 Feng.error("修改失败!");
			}
		});
	}
}



$(function() {

});

var timer="";
//获取车辆信息的下拉框
$("#carryCarId").bind("keyup click",function(){
	//获取车号
	var carId = $("#carryCarId").val();
	//显示下拉框
	var pName = $("#carryCarId");
  var pNameOffset = $("#carryCarId").offset();
  
//清空车号标志
  $("#carId").val("");
  
  //驾驶员，联系电话，手机信息重新按下按键时 清空数据初始化
   $("#carryCarDriver").val("");
   $("#carryCarDriverTell").val("");
   $("#carryCarDriverMobile").val("");
   $("#carryCarDriver").removeAttr("readOnly")
   $("#carryCarDriverTell").removeAttr("readOnly")
   $("#carryCarDriverMobile").removeAttr("readOnly")
    $("#carryCarDriver").css('background-color','');
   $("#carryCarDriverTell").css('background-color','');
   $("#carryCarDriverMobile").css('background-color','');
  
 

//  $("body").bind("mousedown", onBodyDown);
  
  clearTimeout(timer);
	//清空查询信息
	$("#show-Car").empty();
	
	
	timer = setTimeout(function(){
    $.ajax({
           url: Feng.ctxPath + '/car/listbycarid', 
           type: "POST",
              data :{"carId":carId} ,
           dataType:"json",
           success:function(data){
	          	   var cars = data;
	          	   if(JSON.stringify(cars) === '[]'){
	          		 $("#showCar").css({
	            	        left : pNameOffset.left + "px",
	            	        top : pNameOffset.top + pName.outerHeight() + "px"
	            	    }).hide();
	          	   }else{
	          		 for(i in cars){
	          			 var index = parseInt(i)+1;
	                     var $li = $("<li class='XX'></li>");
	                     var car = cars[i];
	                     $li.text(index+"."+car.carId+'('+car.carDriver+')');
	                     $("#show-Car").append($li);
	                 }       
	            	 $("#showCar").css({
	            	        left : pNameOffset.left + "px",
	            	        top : pNameOffset.top + pName.outerHeight() + "px"
	            	    }).show();
	
	                 $("#show-Car li.XX").each(function(){
	                       $(this).click(function(){
	                    	   var text = $(this).text().split(".")[1];
	                    	   text = text.substring(0,text.indexOf("("));
	                            $("#carryCarId").val(text);
	                            var id =parseInt($(this).text().split(".")[0])-1;
	                            $("#carryCarDriver").val(cars[id].carDriver);
	                            $("#carryCarDriver").attr("readonly","readonly");
	                            $("#carryCarDriver").css('background-color','#eee');
	                            
	                            $("#carryCarDriverTell").val(cars[id].carDriverTell);
	                            $("#carryCarDriverTell").attr("readonly","readonly");
	                            $("#carryCarDriverTell").css('background-color','#eee');
	                            
	                            $("#carryCarDriverMobile").val(cars[id].carDriverMobile);
	                            $("#carryCarDriverMobile").attr("readonly","readonly");
	                            $("#carryCarDriverMobile").css('background-color','#eee');
	                            //表明数据是从数据库中而来
	                            $("#carId").val("yes");
	                            $("#showCar").css({
	    	            	        left : pNameOffset.left + "px",
	    	            	        top : pNameOffset.top + pName.outerHeight() + "px"
	    	            	    }).hide();
	                       });
	                   });
	          	   }
           }
        });},10);
});

//获取物流线路信息的下拉框
$("#carryRouteId").bind("keyup click",function(){
	//获取线路号
	var routeId = $("#carryRouteId").val();
	//显示下拉框
	var pName = $("#carryRouteId");
  var pNameOffset = $("#carryRouteId").offset();
  
//清空车号标志
  $("#routeId").val("");
  
  //驾驶员，联系电话，手机信息重新按下按键时 清空数据初始化
   $("#carryRouteStart").val("");
   $("#carryRouteEnd").val("");
   $("#carryRouteStart").removeAttr("readOnly")
   $("#carryRouteEnd").removeAttr("readOnly")
    $("#carryRouteStart").css('background-color','');
   $("#carryRouteEnd").css('background-color','');
  
 

//  $("body").bind("mousedown", onBodyDown);
  
  clearTimeout(timer);
	//清空查询信息
	$("#show-Route").empty();
	
	
	timer = setTimeout(function(){
    $.ajax({
           url: Feng.ctxPath + '/route/listbyrouteid', 
           type: "POST",
              data :{"routeId":routeId} ,
           dataType:"json",
           success:function(data){
	          	   var routes = data;
	          	   if(JSON.stringify(routes) === '[]'){
	          		 $("#showRoute").css({
	            	        left : pNameOffset.left + "px",
	            	        top : pNameOffset.top + pName.outerHeight() + "px"
	            	    }).hide();
	          	   }else{
	          		 for(i in routes){
	          			 var index = parseInt(i)+1;
	                     var $li = $("<li class='XX'></li>");
	                     var route = routes[i];
	                     $li.text(index+"."+route.routeId+"("+route.routeStart+"-->"+route.routeEnd+")");
	                     $("#show-Route").append($li);
	                 }       
	            	 $("#showRoute").css({
	            	        left : pNameOffset.left + "px",
	            	        top : pNameOffset.top + pName.outerHeight() + "px"
	            	    }).show();
	
	                 $("#show-Route li.XX").each(function(){
	                       $(this).click(function(){
	                    	   var text = $(this).text().split(".")[1];
	                    	   text = text.substring(0,text.indexOf("("));
	                            $("#carryRouteId").val(text);
	                            var id =parseInt($(this).text().split(".")[0])-1;
	                            $("#carryRouteStart").val(routes[id].routeStart);
	                            $("#carryRouteStart").attr("readonly","readonly");
	                            $("#carryRouteStart").css('background-color','#eee');
	                            
	                            $("#carryRouteEnd").val(routes[id].routeEnd);
	                            $("#carryRouteEnd").attr("readonly","readonly");
	                            $("#carryRouteEnd").css('background-color','#eee');
	                            
	                            //表明数据是从数据库中而来
	                            $("#routeId").val("yes");
	                            $("#showRoute").css({
	    	            	        left : pNameOffset.left + "px",
	    	            	        top : pNameOffset.top + pName.outerHeight() + "px"
	    	            	    }).hide();
	                       });
	                   });
	          	   }
           }
        });},10);
});

//获取合同信息的下拉框
$("#searchContract").bind("keyup click",function(){
	//获取合同号
	var contractNumber = $("#searchContract").val();
	//显示下拉框
	var pName = $("#searchContract");
	var pNameOffset = $("#searchContract").offset();
	
  clearTimeout(timer);
	//清空查询信息
	$("#show-Contract").empty();
	
	
	timer = setTimeout(function(){
    $.ajax({
           url: Feng.ctxPath + '/carryBasicInformation/querybycontractnumber', 
           type: "POST",
              data :{"searchContract":contractNumber} ,
           dataType:"json",
           success:function(data){
	          	   var receiveBasicInformations = data;
	          	   if(JSON.stringify(receiveBasicInformations) === '[]'){
	          		 $("#showContract").css({
	            	        left : pNameOffset.left + "px",
	            	        top : pNameOffset.top + pName.outerHeight() + "px"
	            	    }).hide();
	          	   }else{
	          		  
	          		 for(i in receiveBasicInformations){
	          			 var index = parseInt(i)+1;
	                     var $li = $("<li class='XX'></li>");
	                     var receiveBasicInformation = receiveBasicInformations[i];
	                     $li.text(index+"."+receiveBasicInformation.receive_contract_number+"("+receiveBasicInformation.receiveConsigner+"-->"+receiveBasicInformation.receiveConsignee+")");
	                     $("#show-Contract").append($li);
	                 }       
	            	 $("#showContract").css({
	            	        left : pNameOffset.left + "px",
	            	        top : pNameOffset.top + pName.outerHeight() + "px"
	            	    }).show();
	
	                 $("#show-Contract li.XX").each(function(){
	                       $(this).click(function(){
	                    	   var text = $(this).text().split(".")[1];
	                    	   text = text.substring(0,text.indexOf("("));
	                            $("#showContract").css({
	    	            	        left : pNameOffset.left + "px",
	    	            	        top : pNameOffset.top + pName.outerHeight() + "px"
	    	            	    }).hide();
	                            
	                            //ajax通过选择的合同号，从后台获取更为详细的数据到表格中
	                            
	                            $.ajax({
	                                url: Feng.ctxPath + '/carryBasicInformation/getbycontractnumber', 
	                                type: "POST",
	                                   data :{"contractNumber":text} ,
	                                dataType:"json",
	                                success:function(data){
	                                	var carry = data;
	                                	var goodsInformations = carry.receiveGoodsInformations; 
	                                	for(i in goodsInformations){
	                                		//库存为0的货物将不予显示
	                                		if(goodsInformations[i].receiveGoodsStock.receiveGoodsQuantity == "0"){
	                                			
	                                		}else{
	                                			var tr =$("<tr></tr>");
		                                		var td1 = $("<td class='id'></td>");
		                                		//合同号
		                                		var td2 = $("<td><input id='carryContractNumber' name='carryContractNumber' type='text' style='background-color:#eee' readonly='readonly'/></td>");
		                                		td2.children().eq(0).val(carry.receiveBasicInformation.receive_contract_number);
		                                		
		                                		
		                                		
		                                		
		                                		//发货人
		                                		var td3 = $("<td><input id='carryConsignerName' name='carryConsignerName' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td3.children().eq(0).val(carry.receiveBasicInformation.receiveConsigner);
		                                		
		                                		//发货人电话
		                                		var td4 = $("<td><input id='carryConsignerTell' name='carryConsignerTell' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td4.children().eq(0).val(carry.receiveBasicInformation.receiveConsignerTell);
		                                		
		                                		//发货人地址
		                                		var td5 = $("<td><input id='carryConsignerPlace' name='carryConsignerPlace' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td5.children().eq(0).val(carry.receiveBasicInformation.receiveConsignerPlace);
		                                		
		                                		//收货人
		                                		var td6 = $("<td><input id='carryConsigneeName' name='carryConsigneeName' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td6.children().eq(0).val(carry.receiveBasicInformation.receiveConsignee);
		                                		
		                                		//收货人电话
		                                		var td7 = $("<td><input id='carryConsigneeTell' name='carryConsigneeTell' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td7.children().eq(0).val(carry.receiveBasicInformation.receiveConsigneeTell);
		                                		
		                                		//收货人地址
		                                		var td8 = $("<td><input id='carryConsigneePlace' name='carryConsigneePlace' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td8.children().eq(0).val(carry.receiveBasicInformation.receiveConsigneePlace);
		                                		
		                                		//货物编号
		                                		var td9 = $("<td><input id='carryGoodsId' name='carryGoodsId'style='background-color:#eee'  readonly='readonly' type='text'/></td>");
		                                		td9.children().eq(0).val(goodsInformations[i].receiveGoodsId);
		                                		
		                                		//货物名称
		                                		var td10 = $("<td><input id='carryGoodsName' name='carryGoodsName' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td10.children().eq(0).val(goodsInformations[i].receiveGoodsName);
		                                		
		                                		//货物规格
		                                		var td11 = $("<td><input id='carryGoodsModel' name='carryGoodsModel' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td11.children().eq(0).val(goodsInformations[i].receiveGoodsModel);
		                                		//包装方式
		                                		var td12 = $("<td><input id='carryGoodsPackage' name='carryGoodsPackage' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td12.children().eq(0).val(goodsInformations[i].receiveGoodsPackage);
		                                		
		                                		
		                                		//本次发货数量
		                                		var td13 = $("<td><input id='carryThisQuantity' name='carryThisQuantity'/></td>");
		                                		
		                                		//未发货数量
		                                		var td14 = $("<td><input id='carryUnQuantity' name='carryUnQuantity' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td14.children().eq(0).val(goodsInformations[i].receiveGoodsStock.receiveGoodsQuantity);
		                                		
		                                		//库存总数量
		                                		var td15 = $("<td><input id='carryStockQuantity' name='carryStockQuantity'  style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td15.children().eq(0).val(goodsInformations[i].receiveGoodsStock.receiveGoodsQuantity);
		                                		
		                                		
		                                		//数量
		                                		var td16 = $("<td><input id='carryGoodsQuantity' name='carryGoodsQuantity' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td16.children().eq(0).val(goodsInformations[i].receiveGoodsQuantity);
		                                		
		                                		
		                                		//重量
		                                		var td17 = $("<td><input id='carryGoodsWeight' name='carryGoodsWeight' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td17.children().eq(0).val(goodsInformations[i].receiveGoodsWeight);
		                                		
		                                		//体积
		                                		var td18 = $("<td><input id='carryGoodsVolume' name='carryGoodsVolume' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td18.children().eq(0).val(goodsInformations[i].receiveGoodsVolume);
		                                		
		                                		//运费
		                                		var td19 = $("<td><input id='carryGoodsFreight' name='carryGoodsFreight' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td19.children().eq(0).val(goodsInformations[i].receiveGoodsFreight);
		                                		
		                                		//信息费
		                                		var td20 = $("<td><input id='carryGoodsMessagefee' name='carryGoodsMessagefee' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td20.children().eq(0).val(goodsInformations[i].receiveGoodsMessagefee);
		                                		
		                                		//提货费
		                                		var td21 = $("<td><input id='carryGoodsPickupCharge' name='carryGoodsPickupCharge' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td21.children().eq(0).val(goodsInformations[i].receiveGoodsPickupCharge);
		                                		
		                                		//仓库
		                                		var td22 = $("<td><input id='carryGoodsWarehouseName' name='carryGoodsWarehouseName' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td22.children().eq(0).val(goodsInformations[i].receiveGoodsWarehouseName);
		                                		//备注
		                                		var td23 = $("<td><input id='carryGoodsRemark' name='carryGoodsRemark' style='background-color:#eee' readonly='readonly' type='text'/></td>");
		                                		td23.children().eq(0).val(goodsInformations[i].receiveGoodsRemark);
		                                		//操作
		                                		var td24 = $("<td></td>");
		                                		td24.html("<button type='button' onclick='del(this);' >删除</button>");
		                                		
		                                		//删除最后一个统计的节点
		                                		$("#sumCopy").remove();
		                                		
		                                		tr.append(td1);
		                                		tr.append(td2);
		                                		tr.append(td3);
		                                		tr.append(td4);
		                                		tr.append(td5);
		                                		tr.append(td6);
		                                		tr.append(td7);
		                                		tr.append(td8);
		                                		tr.append(td9);
		                                		tr.append(td10);
		                                		tr.append(td11);
		                                		tr.append(td12);
		                                		tr.append(td13);
		                                		tr.append(td14);
		                                		tr.append(td15);
		                                		tr.append(td16);
		                                		tr.append(td17);
		                                		tr.append(td18);
		                                		tr.append(td19);
		                                		tr.append(td20);
		                                		tr.append(td21);
		                                		tr.append(td22);
		                                		tr.append(td23);
		                                		tr.append(td24);
		                                		$(".table1").append(tr);
		                                		  $(".table1").append("<tr id='sumCopy'><td colspan='12'>总计</td><td id='carryCount'></td><td id='unCarryCount'></td><td id='stockCount'></td><td id='sumCount'></td><td id='sumWeight'></td><td id='sumVolume'></td><td id='sumFreight'></td><td id='sumMessagefee'></td><td id='sumPickupCharge'></td><td colspan='3'></td>");
	                                		}
	                                	}
	                                	//初始化总计的数量
	                                	initCount();
	                                	//初始化序号
	                                	initId();
	                                }
	                             });
	                            
	                       });
	                   });
	          	   }
           }
        });},10);
});
$("body").click(function(){
	//车辆信息模块
	$("#showCar").hide();
	$("#showRoute").hide();
	$("#showContract").hide();
});

